package domain

import (
	"vrcm/src/vrcm/common/models"
)

type DomainConfig struct {
	models.Model

	TenantId      string `json:"tenant_id" gorm:"type:varchar(50);comment:租户"`
	AcDomain      string `json:"ac_domain" gorm:"type:varchar(100);comment:加速域名"`
	AcType        int    `json:"ac_type" gorm:"type:tinyint;comment:加速类型 1网页小文件 2大文件下载 3音视频点播 4hls直播"`
	AcArea        int    `json:"ac_area" gorm:"type:tinyint;comment:加速区域 1境内 2境外 3全球"`
	DomainTaskId  string `json:"domain_task_id" gorm:"type:varchar(100);comment:域名任务id"`
	CertificateId int    `json:"certificate_id" gorm:"type:bigint;comment:证书id"`
	Cname         string `json:"cname" gorm:"type:varchar(100);comment:cname"`
	DomainState   int    `json:"domain_state" gorm:"type:tinyint;comment:1配置中 2启用 3停用"`
	Range         int    `json:"range" gorm:"type:tinyint;comment:1启用 2停用"`
	ZoneId        string `json:"zone_id" gorm:"type:varchar(100);comment:zone_id"`
	models.ModelTime
	models.ControlBy
}

func (DomainConfig) TableName() string {
	return "domain_config"
}

func (e *DomainConfig) Generate() models.ActiveRecord {
	o := *e
	return &o
}

func (e *DomainConfig) GetId() interface{} {
	return e.Id
}

type DomainConfigModel struct {
	DomainConfig           DomainConfig            `json:"domain_config"`
	SourceStationConfigs   []SourceStationConfig   `json:"source_station_configs"`
	BackSourceConfig       BackSourceConfig        `json:"back_source_config"`
	CacheExpireConfigs     []CacheExpireConfig     `json:"cache_expire_configs"`
	CacheFilterConfigs     []CacheFilterConfig     `json:"cache_filter_configs"`
	DistributionProtocol   DistributionProtocol    `json:"distribution_protocol"`
	Certificate            Certificate             `json:"certificate"`
	StateCodeExpireConfigs []StateCodeExpireConfig `json:"stateCodeExpireConfig"`
	AntiTheftConfig        AntiTheftConfig         `json:"anti_theft_config"`
	OverWriteUrls          []OverWriteUrl          `json:"over_write_urls"`
	UrlSign                UrlSign                 `json:"url_sign"`
	RequestHeaderConfigs   []HeaderConfig          `json:"request_header_configs"`
	ResponseHeaderConfigs  []HeaderConfig          `json:"response_header_configs"`
	CompressConfig         CompressConfig          `json:"compress_config"`
}
